package nickthissen.iracing.common;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtils 
{
	public static String UnixMsToString(long ms)
	{
		Date date = new Date(ms);
		SimpleDateFormat format = new SimpleDateFormat("M/d/yyyy h:mm a");
		return format.format(date);
	}

    public static String UnixMsToShortString(long ms)
    {
        Date date = new Date(ms);
        Date today = new Date();

        SimpleDateFormat format;
        if (date.getDay() == today.getDay())
        {
            // Same day, return just time
            format = new SimpleDateFormat("HH:mm");
        }
        else
        {
            format = new SimpleDateFormat("M/d/yyyy");
        }
        return format.format(date);
    }
}
